package hu.vissy.yacap.option;

/**
 * Logikai argumentumot reprezentáló osztály.
 *
 * <p>
 * Az opció nem vár paramétert és boolean típust szolgáltat.
 * </p>
 *
 * @author vissyb
 *
 */
public class BooleanOption extends CommandLineOption<Boolean> {


    public static class Builder extends CommandLineOptionBuilder<Boolean, Builder> {

        public Builder(String longForm) {
            super(Boolean.class, longForm);
        }

        /**
         * @throws UnsupportedOperationException
         *             Unsupported for this option type.
         */
        @Override
        public Builder withValueName(String valueName) {
            throw new UnsupportedOperationException();
        }

        /**
         * @throws UnsupportedOperationException
         *             Unsupported for this option type.
         */
        @Override
        public Builder withValueOptional() {
            throw new UnsupportedOperationException();
        }


        /**
         * Uses covariant return type to precast result.
         *
         */
        @Override
        public BooleanOption getInstance() {
            return (BooleanOption) super.getInstance();
        }


        @Override
        protected BooleanOption createInstance() {
            return new BooleanOption(longForm);
        }

        @Override
        protected Builder getThis() {
            return this;
        }



    }

    /**
     * Constructor.
     *
     * @param longForm
     *            The long form.
     */
    BooleanOption(String longForm) {
        super(Boolean.class, longForm);
        setValuePolicy(ValuePolicy.NONE);
    }

    @Override
    public Boolean parseValue(String valueString) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean hasValue() {
        return false;
    }

    @Override
    public ValuePolicy getValuePolicy() {
        return ValuePolicy.NONE;
    }

    @Override
    public Boolean getDefaultValue() {
        return true;
    }




}
